<?php
    include('./config.php');
    include('./request.php');
    $marketname = $result->market_name;
    $arr = array();
    try{
        $pdo = new PDO($dsn,$user,$pass);
        $sql = "select * from goods where market_name='".$marketname."'";
        $res = $pdo->prepare($sql);
        $res->execute();
        while($rea = $res->fetch(PDO::FETCH_ASSOC)){
            $goodsObj = array('goods_id'=>$rea['goods_id'],'goods_name'=>$rea['goods_name'],'goods_price'=>$rea['goods_price'],'goods_num'=>$rea['goods_num'],'goods_type'=>$rea['goods_type']);
            array_unshift($arr,$goodsObj);
        }
        echo json_encode($arr);
        }catch(PDOException $e){
        echo "error";
    }
?>